import { createRouter, createWebHashHistory } from 'vue-router'

const router = createRouter({
  history: createWebHashHistory(),
  routes: [
    {
      path: '/',
      redirect: '/login'
    },
    {
      path: '/login',
      name: 'login',
      component: () => import("@/components/Login/Login.vue")
    },
    {
      path: "/register",
      name: 'register',
      component: () => import("@/components/Register/Register.vue")
    },
    {
      path: "/home",
      name: 'home',
      component: () => import("../views/Home.vue"),
      redirect: '/home/recommend',
      meta: {
        keepAlive: true
      },
      children: [
        {
          /* 推荐 */
          path: "/home/recommend",
          name: 'recommend',
          component: () => import("@/views/body/online/recommend/Recommend.vue")
        },
        {
          /* 推荐的列表 */
          path: "/home/recommendList",
          name: 'recommendList',
          component: () => import("@/views/body/myLists/otherLists.vue")
        },
        {
          /* 音乐馆 */
          path: "/home/musicHall",
          name: 'musicHall',
          component: () => import("@/views/body/online/musicHall/MusicHall.vue")
        },
        {
          /* 我喜欢 */
          path: "/home/myLove",
          name: 'myLove',
          component: () => import("@/views/body/myMusic/myLove/myLove.vue"),
          meta: {
            keepAlive: true
          }
        },
        {
          /* 试听列表 */
          path: "/home/audition",
          name: 'audition',
          component: () => import("@/views/body/myMusic/audition/audition.vue"),
          meta: {
            keepAlive: true
          }
        },
        {
          /* 本地和下载 */
          path: "/home/downLoad",
          name: 'downLoad',
          component: () => import("@/views/body/myMusic/downLoad/downLoad.vue"),
          meta: {
            keepAlive: true
          }
        },
        {
          /* 最近播放 */
          path: "/home/laterListen",
          name: 'laterListen',
          component: () => import("@/views/body/myMusic/laterListen/laterListen.vue"),
          meta: {
            keepAlive: true
          }
        },
        {
          /* mv */
          path: "/home/mv",
          name: 'mv',
          component: () => import("@/views/body/mv/Mv.vue"),
          meta: {
            keepAlive: true
          }
        },
        {
          /* vedio */
          path: "/home/vedio",
          name: 'vedio',
          component: () => import("@/views/body/mv/Vedio.vue"),
          meta: {
            keepAlive: true
          }
        },
        {
          /* 创建歌单 */
          path: "/home/myLists/",
          name: 'myLists',
          component: () => import("@/views/body/myLists/myLists.vue"),
          meta: {
            keepAlive: true
          },
          children: [
            {
              path: "/home/myLists/createMusicLists/",
              name: 'createMusicLists',
              component: () => import("@/views/body/myLists/myLists.vue"),
            },
            {
              path: "/home/myLists/collectMusicLists/",
              name: 'collectMusicLists',
              component: () => import("@/views/body/myLists/myLists.vue"),
            }
          ]
        },
        {
          /* 搜索 */
          path: "/search/:keyword?",
          name: 'search',
          component: () => import("@/views/body/search/Search.vue"),
          meta: {
            keepAlive: true
          }
        },
      ]
    }
  ]
})

export default router